package com.aaa.fees.controller.api;

import com.aaa.entity.Charge;
import com.aaa.entity.ChargeItem;
import com.aaa.fees.service.ChargeItemService;
import com.aaa.fees.service.ChargeService;
import com.aaa.fees.vo.ChargeVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("fees/api/charge")
public class ApichargeController {
    @Autowired
    private ChargeService chargeService;
    @Autowired
    private ChargeItemService chargeItemService;
    // 详细查看
    @GetMapping("/item/{orderId}")
    public List<ChargeItem> getItemId(@PathVariable String orderId){
        return chargeItemService.getOrderId(orderId);
    }
    // 查询所有 条件  模糊
    @PostMapping("/infocharge/{currentPage}/{pageSize}")
    public Result<IPage<Charge>> getinfocharge(
            @PathVariable Integer currentPage,
            @PathVariable Integer pageSize,
            @RequestBody ChargeVo chargeVo
    ){
        return chargeService.getinfocharge(currentPage,pageSize, chargeVo);
    }
    //微信支付   订单号  order_id
    @PostMapping("createNavite/{orderId}")
    public Result createNavite(@PathVariable String orderId){
        return chargeService.createNavite(orderId);
    }
    //微信支付  查订单状态
    @PostMapping("queryPayStatus/{orderId}")
    public Result queryPayStatus(@PathVariable String orderId){
        return chargeService.queryPayStatus(orderId);
    }
}
